1. Field of the Invention
The present invention relates to an apparatus for data input and particularly to a keypad or keyboard circuit, and key detection method thereof which achieves low power and system resource consumption.
2. Description of the Prior Art
Generally, there are two configurations of connection of the keypad or keyboard to the host.
One is to connect each of the keys to one of the GPIO (General Purpose Input and Output) pins of a controller in the host. The controller of the host is the only device to detect and identify the keys. This configuration is characterized by its simplicity. However, the controller must have enough GPIO pins to afford such connections and the required number of GPIO pins is equal to the number of keys. Since the GPIO pin number is limited and it is impossible to dedicate all of GPIO pins to the connections of the keypad or keyboard, this configuration only applies to a keypad or keyboard with a small number of keys. Moreover, the controller may not have a pin for interruption, which results in a need for periodical monitoring of the keys and may exhaust the controller resource.
As for the other configuration, it occupies fewer GPIO pins by disposing the key switches on intersections of lines arranged in a matrix and connecting the row and column lines, rather than each of the keys, to the controller. However, the controller must still monitor the keys by scanning the matrix. The monitoring of keys in a matrix is more complicated than that of keys being directly connected. This also exhausts the resource and raises the power consumption of the controller. Moreover, for a keypad or keyboard with a small number of keys, the required number of GPIO pins is not significantly reduced. Thus, this configuration generally applies to a keypad or keyboard with a large number of keys.
Neither of the two previously described configurations can perfectly apply to a PDA (Personal Digital Assistant). The number of keys in the PDA individually depends on its functional features and size requirement. Connecting each of the keys individually to the controller occupies too many GPIO pins and frustrates system designers. Connecting a key matrix to the controller does not significantly lower the burden on the controller and can even raise power consumption. High power consumption is critically disadvantageous to a battery powered PDA.